Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added type hints to Tests/test_font_*.py #7743

Merged
merged 4 commits into from
Jan 24, 2024

Conversation

radarhere
Copy link
Member

No description provided.

@@ -30,6 +30,6 @@ class TestDefaultFontLeak(TestTTypeFontLeak):
iterations = 100
mem_limit = 1024 # k

def test_leak(self):
def test_leak(self) -> None:
default_font = ImageFont.load_default()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this test is checking for leaks with a PIL font and was also broken by #7354.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've created #7748 for this.

@@ -14,7 +15,7 @@

fontname = "Tests/fonts/ter-x20b.pcf"

charsets = {
charsets: dict[str, dict[str, int | str]] = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can remove the assert isinstance(...) calls if you use a TypedDict subclass for the value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've pushed a commit for this.

@@ -20,7 +21,7 @@
pytestmark = skip_unless_feature("zlib")


def save_font(request, tmp_path):
def save_font(request: pytest.FixtureRequest, tmp_path: PosixPath) -> str:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not tmp_path: Path?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I've pushed a commit to update it, both the changes from here and #7732

@hugovk hugovk merged commit be1508f into python-pillow:main Jan 24, 2024
56 checks passed
@hugovk
Copy link
Member

hugovk commented Jan 24, 2024

Thanks!

@radarhere radarhere deleted the type_hint_test_font branch January 24, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants